﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Core;

namespace TestApp
{
    class Program
    {
        static void Main(string[] args)
        {
            Log log = new Log("log.log");
            Chainer chainer = new Chainer();
            foreach (var line in log.Lines)
                line.Chain(chainer);

            ChainFinder finder = new ChainFinder(chainer);
            Chain[] chains = finder.Find("aleksey.nikolaevich@gmail.com");

            Chain[] errorChains = chainer.ClosedChains.Where(chain => chain.Lines.OfType<ProtocolLine>().Any(l => (int)l.StatusCode >= 400)).ToArray();

            foreach (var chain in chains)
                Console.WriteLine(chain);
            Console.ReadLine();
        }
    }
}
